// This is a part of the WceUi library.
// Copyright (C) WceUi Team
// All rights reserved.
//
// Coded by Hui Xu
//
#pragma once
#include "WceUiCommon.h"
#include "WceUiLayer.h"
#include "WceUiXml.h"
#include "wceui.h"

class CWceUiButton : public CWceUiLayer
{
	WCEUI_DYNCREATE_BEGIN(CWceUiButton, CWceUiLayer);
public:
	CWceUiButton();
	virtual ~CWceUiButton();

	virtual void SetProperties(PCWceUiXmlElem pCreateElem);

	virtual void OnLButtonDown(UINT nFlags,  POINT point);
	virtual void OnLButtonUp(UINT nFlags,	 POINT point);
	virtual void OnMouseMove(UINT nFlags,	 POINT point);

	virtual void OnLoseCapture();

public:
	LPCTSTR GetNoramlStyleName() const;
	void	SetNormalStyleName(LPCTSTR pNoramlStyleName);

	LPCTSTR GetDownStyleName() const;
	void	SetDownStyleName(LPCTSTR pDownStyleName);

	LPCTSTR GetFocusStyleName() const;
	void	SetFocusStyleName(LPCTSTR pFocusStyleName);

private:
	enum WCEUI_BUTTON_STATUS
	{
		WCEUI_BUTTON_NORMAL = 1,
		WCEUI_BUTTON_DOWN,
		WCEUI_BUTTON_FOCUS,
	};

	TCHAR m_pNoramlStyleName[MAX_TAG_NAME_LEN];
	TCHAR m_pDownStyleName[MAX_TAG_NAME_LEN];
	TCHAR m_pFocusStyleName[MAX_TAG_NAME_LEN];

	BOOL m_bMouseDown;
	WCEUI_BUTTON_STATUS m_Status;
private:
	void SetStatus(WCEUI_BUTTON_STATUS status);
private:
	CWceUiButton (const CWceUiButton &);
	CWceUiButton & operator=(const CWceUiButton &);
};

WCEUI_DYNCREATE_END(CWceUiButton, CWceUiLayer);

